/*
 * To change this template, choose Tools | Templates and open the template in
 * the editor.
 */
package br.com.menosehmais.framework.security;

import br.com.caelum.vraptor.ioc.Component;
import br.com.caelum.vraptor.ioc.SessionScoped;

/**
 *
 * @author RafaelRosa
 */
@Component
@SessionScoped
public class UserSession {
    
    private AccountInfo accountInfo;
    
    public UserSession(){
        
    }
    
    public UserSession(AccountInfo accountInfo){
        this.accountInfo = accountInfo;
    }
    
    public boolean isLogged() {
        return (accountInfo != null);
    }
    
    public boolean login(AccountInfo accountInfo) {
        this.setAccountInfo(accountInfo);
        if(accountInfo != null){
            return true;
        }
        return false;
    }
    
    public void logout() {
        accountInfo = null;
    }

    public AccountInfo getAccountInfo() {
        return accountInfo;
    }

    public void setAccountInfo(AccountInfo accountInfo) {
        this.accountInfo = accountInfo;
    }    
}
